<?php

namespace app\modules\admin\controllers;

use app\common\controllers\AccessController;
use app\modules\admin\services\InfoService;
use yii\base\UserException;

class InfoController extends AccessController{

    //获取信息
    public function actionGetInfoById($id){
        return InfoService::getInfoById($id);
    }

    //店铺
    public function actionStore(){
        $pagesize = \Yii::$app->getRequest()->get("pagesize");
        return [
            'list'=>InfoService::store($page,$pagesize),
            'page'=>$page->Out()
        ];
    }

    //用户
    public function actionUser(){
        $pagesize = \Yii::$app->getRequest()->get("pagesize");
        return [
            'list'=>InfoService::user($page,$pagesize),
            'page'=>$page->Out()
        ];
    }

    //审核成功
    public function actionSuccess($type,$id){
        if(InfoService::success($type,$id)){
            return "";
        }else{
            throw new UserException(InfoService::getError());
        }
    }

    //审核失败
    public function actionFail($type,$id,$msg){
        if(InfoService::fail($type,$id,$msg)){
            return "";
        }else{
            throw new UserException(InfoService::getError());
        }
    }
}